package cn.ubeta.b2c.api;

import android.net.Uri;
import android.text.TextUtils;

import cn.ubeta.b2c.bean.FeedbackInfo;
import cn.ubeta.b2c.utils.NetworkCallback;
import cn.ubeta.b2c.utils.NetworkHelper;

/**
 * Created by liudengyong on 16/9/6.
 */

public class ApiRoot {

    private static final String PATH = "";

    /**
     * 提交用户反馈
     * @param message
     * @param contact
     * @param cb
     */
    public static void submitFeedback(String message, String contact, NetworkCallback<FeedbackInfo> cb) {
        FeedbackInfo test = FeedbackInfo.getTestData();
        if (test != null) {
            cb.onResponse(test);
        } else {
            String url = String.format("/feedback?message=", Uri.encode(message));
            if (!TextUtils.isEmpty(contact)) {
                url += "&contact=" + Uri.encode(contact);
            }
            NetworkHelper.call(PATH + url, cb);
        }
    }
}
